Xbasic

*ARRAY_APPEND Function

Syntax

N *ARRAY_APPEND(A array[,A value])

Arguments

array

The array that receive the new value.

value

The new value to add to Array.

Description

The *ARRAY_APPEND() function re-dimensions an array and assigns a value to the new array element. It appends value to end of array and provide value if not assigning to it.

Discussion

Example

dim b[1] as C
*array_append(b, "b1")
*array_append(b, "b2")
? b
= [1] = "b1"
[2] = "b2"
dim c[1] as N
*array_append(c, 123)
*array_append(c, 456)
? c
= [1] = 123
[2] = 456

Instead of using *array_append(), the preferred syntax is to use push(), e.g.

dim a[0] as n 
a.push(0) 
a.push(0)
a.push(1)

See Also